import {imagesUrl} from '@/utils/baseUrl'
import {Image, View} from '@tarojs/components'

const SearchBar: React.FC<{iconClick: HomeStore.BindDev; isLogin: boolean}> = ({
  iconClick,
  isLogin
}): JSX.Element => {
  function handleScan() {}

  return (
    <View className="flex w-screen h-40 mb-10 pl-16">
      <View
        className="w-289 h-40 flex justify-start items-center overflow-hidden rounded-4"
        style={{
          backgroundColor: '#4BA4FF'
        }}
      >
        <Image
          src={imagesUrl + 'icon/fangdajing.png'}
          className="w-16 h-16 ml-16"
        ></Image>
        <View className="h-18 text-14 text-white font-light ml-4">
          设备检索{isLogin ? `` : `（未登录）`}
        </View>
      </View>
      {isLogin ? (
        <View className="w-40 h-40 ml-12px" onClick={() => iconClick()}>
          <View className="w-40 h-40 mx-auto flex items-center justify-center">
            <Image src={imagesUrl + 'icon/saomiao.png'} className="w-30 h-30" />
          </View>
          {/* <View className="h-14 text-10 text-center text-white font-light">
            添加设备
          </View> */}
        </View>
      ) : (
        <View className="w-40 h-40 ml-12px" onClick={() => iconClick()}>
          <View className="w-24 h-24 mx-auto">
            <Image src={imagesUrl + 'icon/toLogin.png'} className="w-24 h-24" />
          </View>
          <View className="h-14 text-10 text-center text-white font-light">
            登录
          </View>
        </View>
      )}
    </View>
  )
}
export default SearchBar
